package com.tanhua.server.utils;

import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Administrator
 */
public class JwtUtils {

    public static String createToken(Long id, String mobile, String secret) {
        Map<String, Object> map = new HashMap<>();
        map.put("id", id);
        map.put("mobile", mobile);

        return Jwts.builder()
                .setClaims(map)
                .signWith(SignatureAlgorithm.HS256, secret)
                .compact();
    }
}
